import React, { Component } from 'react';
import { Table } from '@alifd/next';
import {
    refreshAble
} from '@src/components'

import {
    requestReturnVisit,
} from '../../../../reducer/MyProjectAction'


class TabReturnVisitRecord extends Component {
    constructor(props) {
        super(props)
    }

    componentDidMount() {
        this.onRefresh();
    }

    componentWillUnmount() {
        this.props.fetchDataCancle();
    }

    onRefresh = () => {
        this.props.fetchData(requestReturnVisit());
    }

    render() {
        const {data, isRefreshing} = this.props;

        return (
            <Table
                dataSource={data && data.data && data.data.rows || []}
                hasBorder={true}
                rowSelection={{onChange: () => {}}}
                onResizeChange={this.onResizeChange}
                loading={isRefreshing}
                className="visit-record"
                >
                <Table.Column 
                    title="回访时间" 
                    dataIndex="returnDate"
                />
                <Table.Column title="操作人" dataIndex="operator"/>
                <Table.Column title="回访方式" dataIndex="returnType" />
                <Table.Column title="回访结果" dataIndex="returnResult" />
                <Table.Column title="备注" dataIndex="remarks" />
            </Table>
        )
    }
}

export default refreshAble('tabReturnVisitRecord')(TabReturnVisitRecord);